package UT02.db4o;

import java.util.ArrayList;


public class Principal {

	static BaseDeDatos bd;

	public static void consulta(Persona persona) {

		ArrayList<Object> result = bd.consultar(persona);
		if (result.size() == 0)
			System.out.println("there aren't any register of person...");
		else {
			for (Object o : result) {
				Persona p = (Persona) o;
				System.out.println("Name: " + p.getNombre() + " city: "
						+ p.getCiudad());
			}
		}

	}

	public static void main(String[] args) {

		bd = new BaseDeDatos();

//		Persona p1 = new Persona("Juan", 18, "Guadalajara");
//		Persona p2 = new Persona("Ana", 17, "Madrid");
//		Persona p3 = new Persona("Luis", 25, "Granada");
//		Persona p4 = new Persona("Pedro", 16, "Asturias");
//
//		bd.guardar(p1);
//		bd.guardar(p2);
//		bd.guardar(p3);
//		bd.guardar(p4);

		consulta(new Persona(null, 0, null));

		bd.cerrarBD();

	}

}
